"""Definition of the mkpray content type
"""

from zope.interface import implements

from Products.Archetypes import atapi
from Products.ATContentTypes.content import base
from Products.ATContentTypes.content import schemata

# -*- Message Factory Imported Here -*-
from my315ok.xtinfocontent import xtinfocontentMessageFactory as _

from my315ok.xtinfocontent.interfaces import Imkpray
from my315ok.xtinfocontent.config import PROJECTNAME

mkpraySchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-


    atapi.IntegerField(
        'qq',
        storage=atapi.AnnotationStorage(),
        widget=atapi.IntegerWidget(
            label=_(u"qq number"),
            description=_(u""),
        ),
        validators=('isInt'),
    ),


    atapi.StringField(
        'nickname',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"nickname"),
            description=_(u""),
        ),
        required=True,
    ),
    atapi.StringField(
        'fromw',
        storage=atapi.AnnotationStorage(),
        widget=atapi.StringWidget(
            label=_(u"from where"),
            description=_(u""),
        ),
    ),
    atapi.TextField(
        'pray',
        storage=atapi.AnnotationStorage(),
        widget=atapi.RichWidget(
            label=_(u"pray content"),
            description=_(u""),
        ),
        required=True,
    ),


))

# Set storage on fields copied from ATContentTypeSchema, making sure
# they work well with the python bridge properties.

mkpraySchema['title'].storage = atapi.AnnotationStorage()
mkpraySchema['description'].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(mkpraySchema, moveDiscussion=False)


class mkpray(base.ATCTContent):
    """make a pray"""
    implements(Imkpray)

    meta_type = "mkpray"
    schema = mkpraySchema

    title = atapi.ATFieldProperty('title')
    description = atapi.ATFieldProperty('description')

    # -*- Your ATSchema to Python Property Bridges Here ... -*-
    pray = atapi.ATFieldProperty('pray')

    fromw = atapi.ATFieldProperty('fromw')

    qq = atapi.ATFieldProperty('qq')

    nickname = atapi.ATFieldProperty('nickname')


atapi.registerType(mkpray, PROJECTNAME)
